<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="app">
    {{fullName}}
</div>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            firstName: 'lin',
            lastName: 'yi cong'
        },
        // 计算属性：当依赖的值没有发生改变时，不会重新计算
        computed: {
            fullName: function () {
                console.log("计算了一次");
                return this.firstName + " " + this.lastName;
            }
        }
    });
</script>
</body>
</html>